#include "queue.h"

template<class V> bool queue<V>::full(){
	bool Ans;
	Ans=(size==vectr<V>::get_lenght());
	return Ans;
}


template<class V> void queue<V>::push(V elem)
{
		int k;
		if (!full())
		{
			k=((first+size)%(vectr<V>::get_lenght()));
			this->put(k,elem);
			size++;
        }
		else
		{
		    //cerr<<"coda piena"<<endl;
		    ////system("PAUSE");
		    exit(1);
		}
}

template<class V> V queue<V>::popfifo()
{
		if (!empty())
		{
			int k=first;
			first=(first%(vectr<V>::get_lenght()))+1;
			size--;
			return vectr<V>::get(k);
		}
		else
		{
	     	//cerr<<"coda vuota"<<endl;
	    	////system("PAUSE");
	    	exit(1);
		}
}







